﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartSpace.OA
{
    public interface IOAService
    {
        ServiceResult SaveArticle(Article article);
        Article GetArticle(Guid Id);
        PagedList<Article> GetArticles(string typeCode, int start, int limit);

        #region Doc
        /// <summary>
        /// 保存文档项目
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        ServiceResult SaveDocItem(DocItem item);
        /// <summary>
        /// 获取文档目录下的子项目
        /// </summary>
        /// <param name="parentId"></param>
        /// <returns></returns>
        List<DocItem> GetDocItems(Guid parentId);
        /// <summary>
        /// 获取文档目录下特定类型的项目
        /// </summary>
        /// <param name="parentId"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        List<DocItem> GetDocItems(Guid parentId, string type);
        /// <summary>
        /// 获取文档项目
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        DocItem GetDocItem(Guid id);
        /// <summary>
        /// 删除文档项目
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        ServiceResult DeleteDocItem(Guid id);

        /// <summary>
        /// 保存文件
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        ServiceResult SaveDocFile(DocFile file);
        /// <summary>
        /// 获取文件
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        DocFile GetDocFile(Guid id);
        #endregion

        #region Asset
        ServiceResult SaveAsset(Asset asset);
        PagedList<Asset> GetAsset(string filter, Guid orgId, int start, int limit);
        PagedList<Asset> GetAsset(string filter, string type, Guid orgId, int start, int limit);
        Asset GetAsset(Guid id);
        Asset GetAsset(string code);
        ServiceResult DeleteAsset(Guid id);
        #endregion

        #region AttendanceRecord
        /// <summary>
        /// 打卡-上班
        /// </summary>
        ServiceResult ClockIn(string account, DateTime datetime);
        /// <summary>
        /// 打卡-下班
        /// </summary>
        ServiceResult ClockOut(string account, DateTime datetime);

        AttendanceRecord GetAttendanceRecord(string account, int year, int month, int day);
        #endregion

        #region Worklog
        ServiceResult SaveWorkLog(WorkLog log);
        PagedList<WorkLog> GetWorkLogs(string account, int start, int limit);
        List<WorkLog> GetWorkLogs(string account, DateTime date);
        List<DateTime> GetWorkLogs(string account, int year);
        WorkLog GetWorkLog(Guid id);
        #endregion
    }
}
